[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Odd or even          Producing left/right Odd or Even page number

 Testing a number to see whether it's odd or even enables some
 interesting applications.

 The key to determining whether a number is odd or even, is to determine
 whether it's evenly divisible by two. If there's no remainder when divided
 by two, a number is evcn. If there's a remainder of one when divided by
 two, a number is odd. To make this task easy, we'll use the MOD function,
 which returns the remainder of a division.

 The logic in the paragraph above in two user-defined functions. This tip
 a useful application of this technique to test for odd and even page
 numbers.

    ODD(n_number) =
       MOD(numer,2)=1

    EVEN(n_number) =
       MOD(number,2)=0

 Next, there is an interesting technique for enhancing the appearance of
 reports that will be published in "booklet" format with double-sided
 facing pages.

 When designing the page layout for a book-style report, you'll probably
 want the page numbers to appear on the outside edge of the page. Since the
 binding is on the left side, this means you want the page number to appear
 at the right margin of odd-numbered pages and at the left margin of
 even-numbered pages. The next example shows how the page number might
 appear in odd/even page headers.

     +-----------------------------------------------------+
     |  +----------------------+ +----------------------+  |
     |  | Page 2               | |              Page 3  |  |
     |  | ---------------------| |--------------------- |  |
     |  | ... ... ....     ... | |... ... ....      ... |  |
     |  | ... ... ....     ... | |... ... ....      ... |  |
     |  | ... ... ....     ... | |... ... ....      ... |  |
     |  |                ----- | |                ----- |  |
     |  |                ..... | |                ..... |  |
     |  |                      | |                      |  |
     |  +----------------------+ +----------------------+  |
     +-----------------------------------------------------+


 The following seven steps enable you to create alternating page headers
 with page numbers as illustrated

 1. Create the page number
    Use the Field Calculate Create command (/FCC) to create a calculated
    field containing the page number as it appears in the figure. Enter the
    field name and expression as specified before.
    The page number is created by appending to the word Page the current
    page number returned by the PAGENO function. The page number must be
    converted to a character string by the STR function, and the leading
    spaces must be removed by the LTRIM function.

 2. Create two header lines
    Use the Line Create Header Page command (/LCHP) to create a page header
    line on which to place the page number. You can use the up and down
    arrow keys to position the line within the page header area, and then
    press Enter. Select Insert from the Line menu to insert another page
    header line and then select Quit to return to the report layout.

 3. Insert the page number
    Use the Field Insert command (/FI) to place the page number at the left
    margin of the page header line you created in step 2. The Page field
    will be automatically highlighted in the Field menu, since it will be
    the most rcccnt field you created. Just press Enter to insert it at the
    current cursor position. Then move the cursor down to the second page
    header line you created in step 2 and insert the page number field
    again.

 4. Position the "odd" page number
    Use the Move command (/M) to place the second page number at the right
    margin. A shortcut in the Move command is to press F10 and select Right
    from the pop-up menu. Press Enter when you are finished positioning the
    field.

 5. ^bFormat the "odd" page number
    Use the Field Format Right command (/FFR) to right-align the page
    number held. This will ensure that it always abuts the right margin
    regardlcss of the number of digits in the page number.

 6. Create line-logical fields
    Use the Field Calculate Create command (/FCC) to create two logical
    fields that control whether the odd or the even page header line will
    appear on the current page. Enter the logical expressions as specified
    before, which use the ODD and EVEN user-defined functions presented in
    Free Expressions.

 7. Apply line-logical fields
    With the cursor still on the second page header line, use the Line
    Print Logical command (/LPL) to select the OddPage field and then press
    Enter to select the current line. Next, move the cursor up to the first
    page header line and select the Logical command again. This time select
    the EvenPage field and press Enter to select the current line. Select
    Quit to return to the report layout.
    Line logicals are indicated by bold line-type indicators, e.g. Header.
    To verify the line logical expressions, press Shift-F4 to display the
    Line Logical Status box and use the up and down arrow keys to verify
    other lines.

 The odd/even page headers are now complete. Your report can be viewed
 using the Print Go command (/PG) and saved with the Report Save command
 (/RS). Note that you can apply this technique to page footers as well as
 page headers.


This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson